---
title: Plaid
sidebarTitle: Plaid
---

In this section, we present how to connect Plaid to MindsDB.

[Plaid](https://plaid.com/) is a financial technology company that offers a platform and a set of APIs that facilitate the integration of financial services and data into applications and websites. Its services primarily focus on enabling developers to connect with and access financial accounts and data from various financial institutions.

Data from Plaid can be utilized within MindsDB to train AI models and make financial forecasts.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB [locally via Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or use [MindsDB Cloud](https://cloud.mindsdb.com/).
2. To connect Plaid to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to Plaid.

## Connection

The required arguments to establish a connection are as follows:

* `client_id`
* `secret`
* `access_token`
* `plaid_env`

<Tip>
You can get the `client_id`, `secret`, and `access_token` values [here](https://dashboard.plaid.com/team/keys) once you sign in to your Plaid account.
And [here](https://plaid.com/docs/api/tokens/#itempublic_tokenexchange) is how you generate the `access_token` value.
</Tip>

In order to make use of this handler and connect the Plaid app to MindsDB, the following syntax can be used:

```sql
CREATE DATABASE my_plaid 
WITH 
    ENGINE = 'plaid',
    PARAMETERS = {
      "client_id": "YOUR_CLIENT_ID",
      "secret": "YOUR_SECRET",
      "access_token": "YOUR_PUBLIC_KEY",
      "plaid_env": "ENV"
    };
```

It creates a database that comes with two tables: `transactions` and `balance`.

## Usage

Now you can query your data, like this:

```sql
SELECT id, merchant_name, authorized_date, amount, payment_channel
FROM my_plaid.transactions 
WHERE start_date = '2022-01-01' 
AND end_date = '2023-04-11' 
LIMIT 20;
```

And if you want to use functions provided by the Plaid API, you can use the native queries syntax, like this:

```sql
SELECT * FROM my_plaid (
  get_transactions(
    start_date = '2022-01-01',
    end_date = '2022-02-01'
  )
);
```

<Info>
For more information about available actions and development plans, visit [this page](https://github.com/mindsdb/mindsdb/blob/staging/mindsdb/integrations/handlers/plaid_handler/README.md).
</Info>
